using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class next : MonoBehaviour
{
    public Material material_origin;
    public GameObject manager;
    void Start()
    {
        material_origin = new Material(gameObject.transform.GetComponent<Renderer>().material);
        manager = GameObject.Find("manager");
    }

    // Update is called once per frame
    void Update()
    {

    }
    private void OnMouseDown()
    {
        manager managerScript = manager.GetComponent<manager>();
        //将isEnd设置为true
        managerScript.isEnd = false;
        managerScript.level+=1;
        managerScript.StartSpawing();
        Destroy(gameObject);
    }
    private void OnMouseOver()
    //鼠标悬停时调用
    {
        gameObject.transform.GetComponent<Renderer>().material.color = Color.green;
    }
    private void OnMouseExit()
    //鼠标退出时调用
    {
        gameObject.transform.GetComponent<Renderer>().material.color = material_origin.color;
    }
}
